package com.wcy.feign.user;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wcy.entity.User;
import com.wcy.entity.UserRole;
import com.wcy.entity.queryVo.QueryConvertor;
import com.wcy.entity.userVo.AuthorProfile;
import com.wcy.entity.userVo.PasswordObject;
import com.wcy.entity.userVo.UserFiltered;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "cloud-provider-user", contextId = "FeignUserService")
public interface FeignUserService {
    @GetMapping("user/page")
    public ResponseEntity<Page<User>> getPage(@RequestParam(name = "pageNum",defaultValue = "1") int pageNum,
                                              @RequestParam(name = "pageSize",defaultValue = "10") int pageSize) ;
    @GetMapping("user/list")
    public ResponseEntity<List<User>> getList();

    @PostMapping("user/add")
    public ResponseEntity<Void> add(@RequestBody User user);

    @PutMapping("user/update")
    public ResponseEntity<Void> update(@RequestBody User user);

    @DeleteMapping("user/delete/{id}")
    public ResponseEntity<Void> delete(@PathVariable("id") Integer id);

    @PutMapping("user/updateProfile")
    public ResponseEntity<UserFiltered> updateProfile(@RequestBody User user);

    @GetMapping("user/getProfile")
    public ResponseEntity<UserFiltered> getProfile();

    @GetMapping("user/{id}")
    public ResponseEntity<UserFiltered> getUser(@PathVariable("id") Integer id);

    @PostMapping("user/authorProfile")
    public ResponseEntity<AuthorProfile> getAuthorProfile(@RequestBody List<Integer> ids);

    @GetMapping("user/isAuthor")
    public ResponseEntity<Boolean> hasAuthor();

    @PostMapping("user/becomeAuthor")
    public ResponseEntity<Boolean> becomeAuthor();

    @PostMapping("user/alterPassword")
    public ResponseEntity<String> alterPassword(@RequestBody PasswordObject passwordObject);
}
